package router

import (
	"common/helper"
	"runtime/debug"
	"time"

	"github.com/buaazp/fasthttprouter"
	"github.com/fasthttp/router"
	"github.com/valyala/fasthttp"
	"member/controller"
)

var (
	ApiTimeoutMsg = `{"status": "false","data":"服务器响应超时，请稍后重试"}`
	ApiTimeout    = time.Second * 30
	route         *router.Router
	buildInfo     BuildInfo

	fastRouter = fasthttprouter.New()
)

type BuildInfo struct {
	GitReversion   string
	BuildTime      string
	BuildGoVersion string
}

// //新的路由控制器定义
var (
	newTagCtl    = new(controller.TagController)
	newFavCtl    = new(controller.FavController)
	newMemberCtl = new(controller.MemberController)
	newCsCtl     = new(controller.CsController)
	//银行卡管理
	newBankCtl   = new(controller.BankcardController)
	newBannerCtl = new(controller.BannerController)
	//vipCtl = new(controller.MemberVipController)
	newNoticeCtl   = new(controller.NoticeController)
	newMsgCtl      = new(controller.MessageController)
	newSignCtl     = new(controller.PromoSignController)
	newTreasureCtl = new(controller.PromoTreasureController)
	newPdCtl       = new(controller.PromoDepositController)
	newGameCtl     = new(controller.GameController)
	newReportCtl   = new(controller.ReportController)
	newWeekly      = new(controller.PromoWeeklyController)
	newConfigCtl   = new(controller.ConfigController)
	newSmsCtl      = new(controller.SmsController)
	newPayCtl      = new(controller.ThirdController)
	newRecordCtl   = new(controller.RecordController)
	newPBCtrl      = new(controller.PiggyBankController)
	newProxyCtl    = new(controller.ProxyController)
)

func apiServerPanic(ctx *fasthttp.RequestCtx, rcv interface{}) {

	err := rcv.(error)
	if err != nil {
		helper.InfoLog("apiServerPanic:%s", err.Error())
	}

	helper.InfoLog("Stack Info begin")
	bStackInfo := debug.Stack()
	helper.InfoLog("%s", string(bStackInfo))
	helper.InfoLog("Stack Info end")
	recover()
	ctx.SetStatusCode(500)
	return
}

func SetupNewRouter(b BuildInfo) *fasthttprouter.Router {
	fastRouter.PanicHandler = apiServerPanic
	buildInfo = b

	//增加
	fastRouter.POST("/member/game/transaction_callback", newGameCtl.GameTransaction)
	//fastRouter.POST("/member/game/launch", newGameCtl.Launch)

	//增加所有的
	fastRouter.GET("/auth/token", newMemberCtl.Token)
	fastRouter.GET("/auth/offline", newMemberCtl.Logout)
	//fastRouter.GET("/users/avatar")
	fastRouter.GET("/users/info", newMemberCtl.Info)
	fastRouter.GET("/users/check_info", newMemberCtl.VerifyInfo)
	fastRouter.GET("/account/balance", newMemberCtl.Balance)
	fastRouter.GET("/account/withdrawals/config", newPayCtl.WithdrawConfig)
	fastRouter.GET("/account/deposits/records", newPayCtl.DepositList)
	fastRouter.GET("/account/withdrawals/records", newPayCtl.WithdrawList)
	fastRouter.GET("/account/deposit_records", newRecordCtl.Trade)
	fastRouter.GET("/account/balance/details", newMemberCtl.Balance)
	fastRouter.GET("/payment/channels/deposit", newPayCtl.DepositChannel)
	//fastRouter.GET("/payment/withdraw/rate")
	fastRouter.GET("/bankcards", newBankCtl.List)
	fastRouter.GET("/bankcards/types", newBankCtl.BankType)
	fastRouter.GET("/deposit/discounts", newPayCtl.DepositDiscountList)

	fastRouter.GET("/piggy-bank/info", newPBCtrl.QueryInterest)
	fastRouter.GET("/piggy-bank/changes", newPBCtrl.PBChangeRec)
	fastRouter.GET("/piggy-bank/achieve-interest", newPBCtrl.AchieveInterest)
	fastRouter.GET("/piggy-bank/deposit", newPBCtrl.PBDeposit)
	fastRouter.GET("/piggy-bank/withdraw", newPBCtrl.PBWithdraw)

	fastRouter.GET("/promotions/sign-in/config", newSignCtl.Config)
	fastRouter.GET("/promotions/sign-in/record", newSignCtl.Record)
	fastRouter.GET("/promotions/sign-in", newSignCtl.Sign)
	fastRouter.GET("/promotions/sign-in/rewards/records", newSignCtl.RewardRecord)

	fastRouter.GET("/promotions/treasure-box/config", newTreasureCtl.Config)
	fastRouter.GET("/promotions/treasure-box/records", newTreasureCtl.Record)
	fastRouter.GET("/promotions/treasure-box/apply", newTreasureCtl.Apply)
	fastRouter.GET("/promotions/weekly/refund/config", newWeekly.Config)
	fastRouter.GET("/promotions/deposit-bonus/config", newPdCtl.Config)
	//fastRouter.GET("/promotions/bonus/records",newMemberCtl.)
	//fastRouter.GET("/vip/levels")
	//fastRouter.GET("/promotions/lucky-wheel/info")
	//fastRouter.GET("/promotions/lucky-wheel/click")
	//fastRouter.GET("/promotions/lucky-wheel/switch")
	fastRouter.GET("/promotions/total-deposit-activity", newMemberCtl.TotalDeposit)
	fastRouter.GET("/promotions/weekly/deposit-return/config", newConfigCtl.WeekDepositReturn)
	fastRouter.GET("/promotions/weekly/deposit-return/query", newMemberCtl.QueryWeekDepositReturn)
	fastRouter.GET("/promotions/weekly/deposit-return/achieve", newMemberCtl.AchieveWeekDepositReturn)
	fastRouter.GET("/promotions/weekly/deposit-return/lastweek", newMemberCtl.QueryLastWeekDepositRecord)
	fastRouter.GET("/promotions/weekly/deposit-return/thisweek", newMemberCtl.QueryThisWeekDepositRecord)
	fastRouter.GET("/promotions/weekly/lost-return/config", newConfigCtl.WeekLostReturn)
	fastRouter.GET("/promotions/weekly/lost-return/query", newMemberCtl.QueryWeeklostReturn)
	fastRouter.GET("/promotions/weekly/lost-return/achieve", newMemberCtl.AchieveWeeklostReturn)
	fastRouter.GET("/promotions/weekly/running-return/config", newConfigCtl.WeekRunningReturn)
	fastRouter.GET("/promotions/weekly/running-return/query", newMemberCtl.QueryWeekRunningReturn)
	fastRouter.GET("/promotions/weekly/running-return/achieve", newMemberCtl.AchieveWeekRunningReturn)
	fastRouter.GET("/promotions/weekly/running-return/lastweek", newMemberCtl.QueryThisWeekRunningRecord)
	fastRouter.GET("/promotions/weekly/running-return/thisweek", newMemberCtl.QueryLastWeekRunningRecord)
	fastRouter.GET("/promotions/weekly/all-returns", newMemberCtl.QueryAllReturn)
	fastRouter.GET("/promotions/daily/running-return/config", newConfigCtl.DailyRunningReturn)
	fastRouter.GET("/promotions/daily/running-return/query", newMemberCtl.QueryDailyRunningReturn)
	fastRouter.GET("/promotions/daily/running-return/achieve", newMemberCtl.AchieveDailyRunningReturn)
	fastRouter.GET("/promotions/daily/running-return/yesterday", newMemberCtl.QueryYesterdayRunningRecord)
	fastRouter.GET("/promotions/daily/running-return/today", newMemberCtl.QueryDailyRunningRecord)
	fastRouter.GET("/system/announcements", newNoticeCtl.List)
	fastRouter.GET("/system/banners", newBannerCtl.List)
	fastRouter.GET("/system/popup", newConfigCtl.Announcement)
	fastRouter.GET("/system/messages", newMsgCtl.List)
	fastRouter.GET("/system/broadcasts", newConfigCtl.BroadcastConfig)
	//fastRouter.GET("/mails")
	fastRouter.GET("/games/navigation", newMemberCtl.Nav)
	fastRouter.GET("/games/launch", newGameCtl.Launch)
	fastRouter.GET("/games/tags", newTagCtl.List)
	fastRouter.GET("/games/list", newGameCtl.List)
	fastRouter.GET("/games/recommended", newGameCtl.Rec)

	fastRouter.GET("/games/hot", newGameCtl.Hot)
	fastRouter.GET("/games/favorites", newFavCtl.List)
	fastRouter.GET("/games/recommended-favorites", newGameCtl.Fav)
	fastRouter.GET("/games/search", newGameCtl.Search)
	fastRouter.GET("/games/favorites/add", newFavCtl.Insert)
	fastRouter.GET("/games/favorites/remove", newFavCtl.Delete)
	fastRouter.GET("/platforms/count", newGameCtl.Number)
	fastRouter.GET("/platforms/list", newGameCtl.PlatformsList)
	fastRouter.GET("/games/bet-records", newRecordCtl.GameRecord)
	fastRouter.GET("/agent/invite-bonus/config", newConfigCtl.ProxyInviteBonus)
	fastRouter.GET("/agent/summary", newProxyCtl.QueryAccuInfo)
	fastRouter.GET("/agent/team_detail", newProxyCtl.QueryTeamData)
	fastRouter.GET("/agent/weekly-commission/config", newConfigCtl.WeekProxyCommiReturn)
	fastRouter.GET("/agent/weekly-commission/query", newProxyCtl.QueryProxyCommiReturn)
	fastRouter.GET("/agent/weekly-commission/achieve", newProxyCtl.AchieveValidInviteBonus)
	fastRouter.GET("/agent/weekly-commission/last-week-records", newProxyCtl.QuerylastWeekDepositRecord)
	fastRouter.GET("/agent/weekly-commission/this-week-records", newProxyCtl.QuerythisWeekDepositRecord)
	fastRouter.GET("/agent/child/running-return/query", newProxyCtl.QueryChildRunningReturn)
	fastRouter.GET("/agent/child/running-return/receive", newProxyCtl.AchieveChildRunningReturn)
	fastRouter.GET("/agent/child/detail_info", newProxyCtl.QueryProxyChildInfo)
	fastRouter.GET("/agent/recharge-share/config", newConfigCtl.GetRechargeShareCfg)
	fastRouter.GET("/agent/recharge-share/info", newMemberCtl.GetRechargeShareInfo)
	fastRouter.GET("/agent/recharge-share/receive", newMemberCtl.RechargeShare)
	fastRouter.GET("/customer-service/links", newCsCtl.List)
	//fastRouter.GET("/app/download-url")
	fastRouter.GET("/config/platform-links", newConfigCtl.GameConfig)
	fastRouter.GET("/config/active-switches", newConfigCtl.ActiveSwitchList)

	fastRouter.POST("/auth/login", newMemberCtl.Login)
	fastRouter.POST("/users/register", newMemberCtl.Reg)
	fastRouter.POST("/auth/sms/send-mail-code", newSmsCtl.SendMail)
	fastRouter.POST("/auth/sms/send-offline-code", newSmsCtl.Send)
	fastRouter.POST("/password/check-account", newMemberCtl.CheckUserAccount)
	fastRouter.POST("/password/check-phone-send-sms", newMemberCtl.CheckUserPhoneAndSendSms)
	fastRouter.POST("/password/reset", newMemberCtl.ForgetPassword)
	fastRouter.POST("/auth/sms/send-online-phone-code", newSmsCtl.SendOnline)
	fastRouter.POST("/auth/sms/send-online-mail-code", newSmsCtl.SendOnlineMail)
	fastRouter.POST("/users/pay-password", newMemberCtl.UpdatePayPassword)
	fastRouter.POST("/users/login-password", newMemberCtl.UpdatePassword)
	fastRouter.POST("/users/bind-phone", newMemberCtl.BindPhone)
	fastRouter.POST("/users/bind-email", newMemberCtl.BindEmail)
	fastRouter.POST("/users/update", newMemberCtl.Info)
	fastRouter.POST("/users/update/check_info", newMemberCtl.UpdateVerifyInfo)
	fastRouter.POST("/users/pay-password/verification", newMemberCtl.VerificationPayPassword)
	fastRouter.POST("/account/deposits", newPayCtl.Deposit)
	fastRouter.POST("/account/withdrawals", newPayCtl.Withdraw)
	fastRouter.POST("/bankcards", newBankCtl.Insert)
	fastRouter.POST("/bankcards/state", newBankCtl.UpdateState)
	fastRouter.POST("/deposit/apply", newPayCtl.DepositDiscountApply)
	//fastRouter.POST("/promotions/lucky-wheel/apply")
	fastRouter.POST("/promotions/accrued-bonus", newMemberCtl.AchieveAccuDepositBonus)
	//fastRouter.POST("/messages/read")
	//fastRouter.POST("/messages/delete")
	fastRouter.POST("/invites/records", newRecordCtl.InviteRecord)
	fastRouter.POST("/invites/reports/total", newReportCtl.Detail)
	fastRouter.POST("/invites/report", newReportCtl.List)
	fastRouter.POST("/agent/child/info", newProxyCtl.QueryProxyDirectChildInfo)
	fastRouter.POST("/agent/team/info", newProxyCtl.QueryTeamData)
	fastRouter.POST("/agent/team/detail", newProxyCtl.QueryProxyChildDetailInfo)
	fastRouter.POST("/agent/recharge-share/record", newMemberCtl.RechargeShareRecord)
	fastRouter.POST("/wagering/records", newRecordCtl.FlowRecordList)

	// 增加代理 缺少的部分
	fastRouter.POST("/Proxy/QueryChildItemInfo", newProxyCtl.QueryChildItemInfo)
	fastRouter.POST("/Proxy/QueryProxyDailyRunning", newProxyCtl.QueryProxyDailyRunning)
	fastRouter.POST("/Proxy/QueryProxyDailyCommi", newProxyCtl.QueryProxyDailyCommi)
	fastRouter.POST("/Agent/AgentDailyGameRecord", newProxyCtl.QueryChildGameRecord)
	fastRouter.POST("/Agent/AgentDailySubDetail", newProxyCtl.QueryProxyDailySubDetail)

	//补缺补漏

	// 首页最新赢家列表
	fastRouter.GET("/user/uptodate_win", newMemberCtl.LastWinRecord)
	fastRouter.GET("/users/order_record", newRecordCtl.Trade)

	fastRouter.GET("/vip_config", newConfigCtl.GetVipList)
	fastRouter.GET("/users/vip_award", newMemberCtl.GetVipBonus)
	fastRouter.GET("/users/vip_info", newMemberCtl.VipInfo)

	fastRouter.GET("/agent/box_award_info", newProxyCtl.GetValidInviteBonusInfo)
	fastRouter.POST("/agent/box_award_take", newProxyCtl.AchieveValidInviteBonus)

	fastRouter.GET("/users/fd-award_info", newMemberCtl.GetFirstDepositBonusInfo)
	fastRouter.POST("/users/fd_award_record", newMemberCtl.FirstDepositBonusRecord)

	//增加抽奖接口
	fastRouter.GET("/h5/lottery/info", newMemberCtl.LotteryInfo) //抽奖基础信息
	fastRouter.GET("/h5/lottery/rec", newMemberCtl.LotteryRec)   //上一次中奖名单
	fastRouter.GET("/h5/lottery/rule", newMemberCtl.LotteryRule)

	//增加充值回调
	//回调
	fastRouter.POST("/pay/betcat/callback", newPayCtl.CallbackBetcatpay)
	fastRouter.POST("/pay/pay4/callback", newPayCtl.CallbackPay4z)
	fastRouter.POST("/pay/u2c/callback", newPayCtl.CallbackU2CPay)

	return fastRouter
}

// SetupRouter 设置路由列表
func SetupRouter(b BuildInfo) *router.Router {

	route = router.New()
	route.PanicHandler = apiServerPanic
	buildInfo = b

	AddPayGroup()
	AddSmsGroup()
	AddMemberGroup()
	AddConfigGroup()
	AddProxyGroup()
	AddPiggyBank()
	AddTurnTable()

	//AddNewGamesGroup()
	//AddNewAuthGroup()
	return route
}
func AddTurnTable() {
	//转盘管理
	turnTableGroup := route.Group("/turnTable")
	turnTableCtl := new(controller.TurnTableController)

	// 转盘信息
	post(turnTableGroup, "/cfg", turnTableCtl.TurnTableCfg)
	post(turnTableGroup, "/click", turnTableCtl.Click)

	get(turnTableGroup, "/TurnTableRecord", turnTableCtl.TurnTableRecord)
	get(turnTableGroup, "/TurnTableOtherRecord", turnTableCtl.TurnTableOtherRecord)
	get(turnTableGroup, "/UserTurnTableInfo", turnTableCtl.UserTurnTableInfo)

	//奖励金额领取申请
	//	post(turnTableGroup, "/turnTable/apply", turnTableCtl.Apply)

}

// 储蓄罐 相关接口
func AddPiggyBank() {
	PBCtrl := new(controller.PiggyBankController)
	PBGroup := route.Group("/PiggyBank")

	get(PBGroup, "/withdraw", PBCtrl.PBWithdraw)
	get(PBGroup, "/deposit", PBCtrl.PBDeposit)

	get(PBGroup, "/PBChangeRec", PBCtrl.PBChangeRec)
	get(PBGroup, "/QueryInterest", PBCtrl.QueryInterest)
	get(PBGroup, "/AchieveInterest", PBCtrl.AchieveInterest)
}
func AddProxyGroup() {
	proxyCtl := new(controller.ProxyController)
	proxyGroup := route.Group("/Proxy")
	get(proxyGroup, "/accuInfo", proxyCtl.QueryAccuInfo)
	get(proxyGroup, "/QueryProxyCommi", proxyCtl.QueryProxyCommiReturn)
	get(proxyGroup, "/AchieveProxyCommi", proxyCtl.AchieveProxyCommiReturn)
	post(proxyGroup, "/queryTeam", proxyCtl.QueryTeamData)
	post(proxyGroup, "/queryChildWithdraw", proxyCtl.QueryChildWithdraw)
	get(proxyGroup, "/lastWeekRecord", proxyCtl.QuerylastWeekDepositRecord)
	get(proxyGroup, "/thisWeekRecord", proxyCtl.QuerythisWeekDepositRecord)

	post(proxyGroup, "/AchieveValidInviteBonus", proxyCtl.AchieveValidInviteBonus)
	get(proxyGroup, "/ValidInviteBonusInfo", proxyCtl.GetValidInviteBonusInfo)

	//仿台新增的接口
	get(proxyGroup, "/QueryChildRunningReturn", proxyCtl.QueryChildRunningReturn)     //查询下级流水返利
	get(proxyGroup, "/AchieveChildRunningReturn", proxyCtl.AchieveChildRunningReturn) //领取下级流水返利

	post(proxyGroup, "/QueryProxyDirectChildInfo", proxyCtl.QueryProxyDirectChildInfo)
	get(proxyGroup, "/QueryProxyChildInfo", proxyCtl.QueryProxyChildInfo)
	post(proxyGroup, "/QueryProxyChildDetailInfo", proxyCtl.QueryProxyChildDetailInfo)

	post(proxyGroup, "/QueryChildItemInfo", proxyCtl.QueryChildItemInfo)

	//代理细化
	post(proxyGroup, "/QueryProxyDailyRunning", proxyCtl.QueryProxyDailyRunning)
	post(proxyGroup, "/QueryProxyDailyCommi", proxyCtl.QueryProxyDailyCommi)

	post(proxyGroup, "/QueryProxyDailyGameRecord", proxyCtl.QueryChildGameRecord)

	post(proxyGroup, "/QueryProxyDailySubDetail", proxyCtl.QueryProxyDailySubDetail)
}

func AddConfigGroup() {
	configGroup := route.Group("/Config")
	configCtl := new(controller.ConfigController)

	get(configGroup, "/weekDepositReturn", configCtl.WeekDepositReturn)
	get(configGroup, "/weekLostReturn", configCtl.WeekLostReturn)
	get(configGroup, "/weekRunningReturn", configCtl.WeekRunningReturn)
	get(configGroup, "/weekProxyCommiReturn", configCtl.WeekProxyCommiReturn)
	get(configGroup, "/accuDepositBonus", configCtl.AccuDepositBonus)
	get(configGroup, "/proxyInviteBonus", configCtl.ProxyInviteBonus)
	get(configGroup, "/proxyInviteBonusByAmount", configCtl.ProxyInviteBonusByAmount)
	get(configGroup, "/ActiveSwitchCfg", configCtl.ActiveSwitchCfg)
	get(configGroup, "/Announcement", configCtl.Announcement)
	get(configGroup, "/platformLink", configCtl.GameConfig)
	get(configGroup, "/dailyRunningReturn", configCtl.DailyRunningReturn)
	get(configGroup, "/broadcast", configCtl.BroadcastConfig)
	get(configGroup, "/vipCfg", configCtl.GetVipList)
	get(configGroup, "/suspension/images", configCtl.SuspensionImages)
	get(configGroup, "/active/switch/list", configCtl.ActiveSwitchList)
	get(configGroup, "/rechargeShareCfg", configCtl.GetRechargeShareCfg)
}

// 后期 AddMemberGroup 里面关于配置的可以调整到AddConfigGroup
func AddMemberGroup() {
	// app升级
	upgradeCtl := new(controller.UpgradeController)
	favCtl := new(controller.FavController)
	tagCtl := new(controller.TagController)

	memberCtl := new(controller.MemberController)
	//银行卡管理
	bankCtl := new(controller.BankcardController)
	bannerCtl := new(controller.BannerController)
	//vipCtl := new(controller.MemberVipController)
	noticeCtl := new(controller.NoticeController)
	msgCtl := new(controller.MessageController)
	signCtl := new(controller.PromoSignController)
	treasureCtl := new(controller.PromoTreasureController)
	recordCtl := new(controller.RecordController)
	pdCtl := new(controller.PromoDepositController)
	gameCtl := new(controller.GameController)
	reportCtl := new(controller.ReportController)
	csCtl := new(controller.CsController)
	weekly := new(controller.PromoWeeklyController)

	//系统数据设置
	systemDataSettingCtl := new(controller.SystemDataSettingController)

	memberGroup := route.Group("/member")
	get(memberGroup, "/cs/list", csCtl.List)

	// app升级检测
	get(memberGroup, "/app/upgrade", upgradeCtl.Info)
	get(memberGroup, "/dataSetting/get", systemDataSettingCtl.GetSystemDataSettingByDataKey)

	get(memberGroup, "/fav/delete", favCtl.Delete)
	get(memberGroup, "/fav/list", favCtl.List)
	get(memberGroup, "/fav/insert", favCtl.Insert)

	get(memberGroup, "/logout", memberCtl.Logout)

	post(memberGroup, "/reg", memberCtl.Reg)

	get(memberGroup, "/tag/list", tagCtl.List)
	// 会员信息
	get(memberGroup, "/token", memberCtl.Token)
	get(memberGroup, "/info", memberCtl.Info)

	// 检测会员账号是否可用
	get(memberGroup, "/valid", memberCtl.Valid)
	// 会员登陆
	post(memberGroup, "/login", memberCtl.Login)
	// 会员余额信息 中心钱包和锁定钱包
	get(memberGroup, "/balance", memberCtl.Balance)
	// 用户忘记密码
	post(memberGroup, "/password/forget", memberCtl.ForgetPassword)
	//检测账户
	post(memberGroup, "/password/checkAccount", memberCtl.CheckUserAccount)
	//检测手机并发送短信
	post(memberGroup, "/password/checkPhoneAndSendSms", memberCtl.CheckUserPhoneAndSendSms)
	// 用户修改密码
	post(memberGroup, "/password/update", memberCtl.UpdatePassword)
	// 用户修改支付密码
	post(memberGroup, "/pay/password/update", memberCtl.UpdatePayPassword)
	// 用户验证支付密码
	post(memberGroup, "/pay/password/verification", memberCtl.VerificationPayPassword)
	// 绑定手机号
	post(memberGroup, "/bind/phone", memberCtl.BindPhone)
	// 绑定邮箱
	post(memberGroup, "/bind/email", memberCtl.BindEmail)

	post(memberGroup, "/update/info", memberCtl.UpdateInfo)
	//新增银行卡
	post(memberGroup, "/bankcard/insert", bankCtl.Insert)
	//修改银行卡状态
	post(memberGroup, "/bankcard/update/state", bankCtl.UpdateState)
	//查询银行卡
	get(memberGroup, "/bankcard/list", bankCtl.List)
	//查询银行类型
	get(memberGroup, "/banktype/list", bankCtl.BankType)
	// 导航栏列表
	get(memberGroup, "/lastwin", memberCtl.LastWinRecord)
	// 导航栏
	get(memberGroup, "/nav", memberCtl.Nav)

	get(memberGroup, "/game/hot/list", gameCtl.Hot)
	get(memberGroup, "/game/rec/list", gameCtl.Rec)
	get(memberGroup, "/game/fav/list", gameCtl.Fav)
	get(memberGroup, "/game/search", gameCtl.Search)
	//
	get(memberGroup, "/game/list", gameCtl.List)
	//平台下的游戏数量
	get(memberGroup, "/game/number", gameCtl.Number)
	//游戏启动
	get(memberGroup, "/game/launch", gameCtl.Launch)
	// 游戏返回处理
	post(memberGroup, "/game/transaction", gameCtl.GameTransaction)

	// 站内信-列表
	get(memberGroup, "/message/list", msgCtl.List)
	// 站内信-读取
	post(memberGroup, "/message/read", msgCtl.Read)
	// 站内信-未读数
	get(memberGroup, "/message/num", msgCtl.Num)
	// 站内信-删除
	post(memberGroup, "/message/delete", msgCtl.Delete)

	// 广告列表
	get(memberGroup, "/banner", bannerCtl.List)
	// 公告列表
	get(memberGroup, "/notice", noticeCtl.List)

	// 签到活动-配置
	get(memberGroup, "/sign/config", signCtl.Config)
	// 签到活动-记录
	get(memberGroup, "/sign/record", signCtl.Record)
	// 签到活动-奖励记录
	get(memberGroup, "/sign/reward/record", signCtl.RewardRecord)
	// 签到活动-签到
	get(memberGroup, "/sign", signCtl.Sign)

	// 宝箱活动-配置
	get(memberGroup, "/treasure/config", treasureCtl.Config)
	// 宝箱活动-记录
	get(memberGroup, "/treasure/record", treasureCtl.Record)
	// 宝箱活动-申请
	get(memberGroup, "/treasure/apply", treasureCtl.Apply)

	// 周投注活动-配置
	get(memberGroup, "/weekly/config", weekly.Config)

	// 存款活动
	get(memberGroup, "/promo/deposit/config", pdCtl.Config)

	//充值提款订单
	get(memberGroup, "/record", recordCtl.Trade)
	//投注记录
	get(memberGroup, "/game/record", recordCtl.GameRecord)

	// 邀请记录
	post(memberGroup, "/invite/record", recordCtl.InviteRecord)
	// 邀请明细总面板
	post(memberGroup, "/report/detail", reportCtl.Detail)
	// 邀请明细列表
	post(memberGroup, "/report/list", reportCtl.List)
	// 邀请明细
	get(memberGroup, "/invite/detail", reportCtl.InviteDetail)

	// 打码记录
	post(memberGroup, "/flow/record/list", recordCtl.FlowRecordList)

	//获取玩家汇总数据
	post(memberGroup, "/accu", memberCtl.MemberAccData)

	//查询周充值返还
	get(memberGroup, "/weekly/depoist/query", memberCtl.QueryWeekDepositReturn)

	//查询上周充值
	get(memberGroup, "/weekly/deposit/lastRecord", memberCtl.QueryLastWeekDepositRecord)

	//查询本周充值
	get(memberGroup, "/weekly/deposit/thisRecord", memberCtl.QueryThisWeekDepositRecord)

	//领取周返还
	get(memberGroup, "/weekly/deposit/Achieve", memberCtl.AchieveWeekDepositReturn)

	//查询周亏损
	get(memberGroup, "/weekly/lost/query", memberCtl.QueryWeeklostReturn)
	//领取周亏损
	get(memberGroup, "/weekly/lost/Achieve", memberCtl.AchieveWeeklostReturn)

	//查询周投注
	get(memberGroup, "/weekly/running/query", memberCtl.QueryWeekRunningReturn)
	//领取周投注
	get(memberGroup, "/weekly/running/Achieve", memberCtl.AchieveWeekRunningReturn)

	//查询本周投注记录
	get(memberGroup, "/weekly/running/thisRecord", memberCtl.QueryThisWeekRunningRecord)
	//查询上周投注记录
	get(memberGroup, "/weekly/running/lastRecord", memberCtl.QueryLastWeekRunningRecord)

	//查询投注记录
	get(memberGroup, "/weekly/queryAllReturn", memberCtl.QueryAllReturn)

	//累计充值奖励
	get(memberGroup, "/total/deposit", memberCtl.TotalDeposit)
	//领取累计充值梯度奖励
	post(memberGroup, "/action/accuBonus", memberCtl.AchieveAccuDepositBonus)

	//领取下载APP赠送奖金
	get(memberGroup, "/action/appDownloadBonus", memberCtl.GetAppDownloadBonus)

	//查询日投注返还
	get(memberGroup, "/Daily/running/query", memberCtl.QueryDailyRunningReturn)
	//领取日投注返还
	get(memberGroup, "/Daily/running/Achieve", memberCtl.AchieveDailyRunningReturn)

	//查询本日投注记录
	get(memberGroup, "/Daily/running/thisRecord", memberCtl.QueryDailyRunningRecord)
	//查询昨日投注记录
	get(memberGroup, "/Daily/running/lastRecord", memberCtl.QueryYesterdayRunningRecord)

	get(memberGroup, "/vipBonus", memberCtl.GetVipBonus)
	get(memberGroup, "/vipinfo", memberCtl.VipInfo)

	get(memberGroup, "/rechargeShareInfo", memberCtl.GetRechargeShareInfo)
	get(memberGroup, "/rechargeShare", memberCtl.RechargeShare)
	post(memberGroup, "/rechargeShareRecord", memberCtl.RechargeShareRecord)

	get(memberGroup, "/first/deposit/bonus/info", memberCtl.GetFirstDepositBonusInfo)
	post(memberGroup, "/first/deposit/bonus/record", memberCtl.FirstDepositBonusRecord)

	// 绑定cpf
	get(memberGroup, "/verify/info", memberCtl.VerifyInfo)
	post(memberGroup, "/update/verify/info", memberCtl.UpdateVerifyInfo)

	// 充值订单信息
	get(memberGroup, "/deposit/info", memberCtl.DepositInfo)

	get(memberGroup, "/platform/list", gameCtl.PlatformsList)
}
func AddSmsGroup() {
	smsCtl := new(controller.SmsController)
	smsGroup := route.Group("/sms")
	// 验证码
	post(smsGroup, "/send", smsCtl.Send)
	// 验证码
	post(smsGroup, "/send/mail", smsCtl.SendMail)
	// 验证码
	post(smsGroup, "/send/online", smsCtl.SendOnline)
	// 验证码
	post(smsGroup, "/send/online/mail", smsCtl.SendOnlineMail)
	//kmi短信回调
	get(smsGroup, "/callback/kmi", smsCtl.CallbackKmi)
}
func AddPayGroup() {
	payCtl := new(controller.ThirdController)

	payGroup := route.Group("/pay")
	//充值通道
	get(payGroup, "/channel", payCtl.DepositChannel)
	//充值
	post(payGroup, "/deposit", payCtl.Deposit)
	//提现配置
	get(payGroup, "/withdraw/config", payCtl.WithdrawConfig)
	//提现
	post(payGroup, "/withdraw", payCtl.Withdraw)

	//回调
	post(payGroup, "/callback", payCtl.CallbackEpay)

	//四方回调
	post(payGroup, "/jeepay/callback", payCtl.CallbackJeepay)
	//回调
	post(payGroup, "/cepay/callback", payCtl.CallbackCepay)

	//回调
	post(payGroup, "/betcat/callback", payCtl.CallbackBetcatpay)

	//充值列表
	get(payGroup, "/deposit/list", payCtl.DepositList)
	//提现列表
	get(payGroup, "/withdraw/list", payCtl.WithdrawList)
	//充值奖励可领取列表
	get(payGroup, "/deposit/discount/list", payCtl.DepositDiscountList)
	//充值奖励领取
	post(payGroup, "/deposit/discount/apply", payCtl.DepositDiscountApply)
}

// get is a shortcut for router.GET(path string, handle fasthttp.RequestHandler)
func get(g *router.Group, path string, handle fasthttp.RequestHandler) {
	g.GET(path, fasthttp.TimeoutHandler(handle, ApiTimeout, ApiTimeoutMsg))
}

// post is a shortcut for router.POST(path string, handle fasthttp.RequestHandler)
func post(g *router.Group, path string, handle fasthttp.RequestHandler) {
	g.POST(path, fasthttp.TimeoutHandler(handle, ApiTimeout, ApiTimeoutMsg))
}
